﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class CreateCube : MonoBehaviour
{
    public GameObject cubePerfab;
    public float interval_Time;//间隔时间
    private float next_Time;//下次生成时间

    private void Update()
    {
        if (Time.time > next_Time)
        {
            // GameObject.CreatePrimitive(PrimitiveType.Cube);
            Instantiate(cubePerfab, Vector3.forward * 5, cubePerfab.transform.rotation);//实例化，生成，克隆
            next_Time += interval_Time;//改变下次生成时间
        }
    }
}